﻿using System;
using EasyStep.Attributes;using EasyStep.TestExecution.Data;using EasyStep.TestExecution.Interfaces;

using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;

namespace EasyStep.TestActions.Actions.Click
{
    [TestAction(typeof(Click), Name = "ByCss", RequireData = false)]
    class ClickByCss : ITestAction<Manager>
    {

        public void Execute(Manager browser, TestStepResult data, IExecuteDataContext context)
        {
            var el = browser.ActiveBrowser.Find.ByExpression(new string[] { data.Locator });
            if (el == null)
                throw new ArgumentNullException("Can't find element by html expression:"+data.Locator);
            browser.ActiveBrowser.Actions.Click(el);
        }
    }
}
